﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="QueryGoodStock.aspx.cs" Inherits="Web.Admin.Good.QueryGoodStock" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <link href="../../Styles/Common.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/WebInner.js" type="text/javascript"></script>
    <script src="../../Scripts/Common.js" type="text/javascript"></script>
    <script src="../../Scripts/Zebra/zebra_dialog.js" type="text/javascript"></script>
    <link href="../../Scripts/Zebra/zebra_dialog.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        
    </style>
    <script type="text/javascript">
        /*--------窗体启动设置和基本设置--------*/

        $(function () {

            InitWBID();
            $('#QWBID').change(function () {
                if ($('#QWBID option:selected').val() != "") {
                    $('#txtWBID').val($('#QWBID option:selected').text());
                  
                }
            });

        });

        function InitWBID() {
            var WBName = $.trim($('#txtWBID').val());
            $('#QWBID').empty();
            $.ajax({
                url: '/Ashx/wbinfo.ashx?type=GetWBByName&strName=' + WBName,
                type: 'post',
                data: '',
                dataType: 'json',
                success: function (r) {
                    if (WBName == '') {
                        $('#QWBID').append("<option value=''>--请选择--</option>");
                    }
                    if (r.responseText == "Error") { return false; }
                    for (var i = 0; i < r.length; i++) {
                        $('#QWBID').append("<option value='" + r[i].ID + "'>" + r[i].strName + "</option>");
                    }
                   
                }, error: function (r) {

                }
            });
        }


        function ShowUpdateQuantity(WBID, GoodID, Quantity) {
            $('#WBID').val(WBID);
            $('#GoodID').val(GoodID);
            $('#divfrm').show();
            $('input[name=Quantity]').val(Quantity);
          
        }

        function FunUpdateQuantity() {
            var Quantity = $('input[name=Quantity]').val();
            if (!CheckNumInt(Quantity, '库存数量', '0', '-1')) {
                return false;
            }
            var WBID = $('#WBID').val();
            var GoodID = $('#GoodID').val();
            /*--------数据提交--------*/
            $.ajax({
                url: '/Ashx/good.ashx?type=UpdateGoodQuantity&WBID=' + WBID+'&GoodID='+GoodID+'&Quantity='+Quantity,
                type: 'post',
                data: '',
                dataType: 'txt',
                success: function (r) {
                    if (r == "OK") {
                        $.Zebra_Dialog('<strong>修改库存数量成功！</strong>');
                      
                    } else {
                        $.Zebra_Dialog('<strong>修改库存数量失败 ！</strong>');
                    }
                }, error: function (r) {
                    $.Zebra_Dialog('<strong>修改库存数量失败 ！</strong>');
                }
            });
            /*--------End 数据提交--------*/
        }


        function frmClose() {
            $('#divfrm').hide();
        }



  
    </script>
</head>
<body>
    <form id="form1" runat="server">
     <div class="pageHead">
        <b>网店库存查询</b><%--<span id="spanHelp" style="cursor: pointer">帮助</span>--%>
    </div>
    <div id="divHelp" class="pageHelp">
        <span>提示1：如果商品很多，直接找到商品更易操作，可以按商品名称查询。</span><br />
        <span>提示2：在添加网点商品前，请维护本网点的供应商信息和仓库信息。</span><br />
        <span>提示3：在网点商品储量不足时，请及时添加商品库存。</span><br />
    </div>
   <div class="QueryHead">
    <span>网点名称:</span>
            <input type="text" id="txtWBID" onkeyup="InitWBID();" style="font-size:16px; width:100px; font-weight:bolder;" runat="server" />
            <select id="QWBID"  runat="server" style="width:100px;"></select> &nbsp;
            <span>商品名称:</span><input type="text" id="txtstrName" runat="server" /> 
             <asp:ImageButton ID="ImageButton1" runat="server" 
                    ImageUrl="~/images/seach_brown.png" onclick="ImageButton1_Click" />

</div>
    <asp:Repeater ID="Repeater1" runat="server">
        <HeaderTemplate>
            <table class="tabData">
                <tr class="tr_head">
                    <th style="width: 200px; text-align: center;">
                        商品名称
                    </th>
                    <th style="width: 100px; text-align: center;">
                        规格型号
                    </th>
                     <th style="width: 100px; text-align: center;">
                        进货价格
                    </th>
                    <th style="width: 100px; text-align: center;">
                        兑换价格
                    </th>
                    <th style="width: 100px; text-align: center;">
                        销售价格
                    </th>
                    <th style="width: 100px; text-align: center;">
                        批发价格
                    </th>
                     <th style="width: 100px; text-align: center;">
                        库存
                    </th>
                     <th style="width: 100px; text-align: center;">
                       操作
                    </th>
                   
                </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr style='background-color: <%#(Container.ItemIndex%2==0)?"#FFFFF;":"#fcf3f4"%>'
                onmouseover="change_colorOver(this)" onmouseout="change_colorOut(this)">
                <td style="height:25px;">
                    <%#Eval("strName")%>
                </td>
                 <td>
                    <%#Eval("PackingSpecID")%>
                </td>
                <td>
                    <%#Eval("Price_Stock")%>
                </td>
                 <td>
                    <%#Eval("Price_DuiHuan")%>
                </td>
                <td>
                    <%#Eval("Price_XiaoShou")%>
                </td>
                <td>
                    <%#Eval("Price_PiFa")%>
                </td>
                 <td>
                    <%#GetGoodStorage( Eval("ID"))%>
                </td>
                <td>
                <%#GetUpdateItem(Eval("ID"))%>
                   
                </td>
                
             
            </tr>
        </ItemTemplate>
        <FooterTemplate>
            <!--底部模板-->
            </table>
            <!--表格结束部分-->
        </FooterTemplate>
    </asp:Repeater>
    
    <webdiyer:AspNetPager ID="AspNetPager1" runat="server"
      FirstPageText="首页" LastPageText="尾页"  PrevPageText="上一页" NextPageText="下一页" 
        NumericButtonTextFormatString="[{0}]" PageSize="20" 
        onpagechanging="AspNetPager1_PageChanging" >
    </webdiyer:AspNetPager>

    <div id="divfrm" class="pageEidt" style="display: none; top:50px;  width: 380px; height: 220px;">
     <div style="float: left; width:80%; color:Blue; font-weight:bolder; margin: 2px 20px">
          [修改网点商品库存]
            </div>
        <div style="float: right; margin: 0px 20px 5px 0px">
            <input type="button" style="width: 60px; background-color: #ccc;" value="关闭" onclick="frmClose()" />
         </div>
        <div style="clear: both;">
            <table>
                <tr>
                    <td align="right" style="width: 100px;">
                        <span></span>
                    </td>
                    <td>
                       <span style="color: Red;font-weight: bolder;">请输入该商品的实际库存数量</span>
                    </td>
                </tr>
               
                <tr>
                    <td align="right">
                        <span>库存数量:</span>
                    </td>
                    <td>
                        <input type="text" name="Quantity" style="width: 200px;" />
                    </td>
                </tr>

                <tr>
                    <td>
                    </td>
                    <td>
                   
                        <input type="button" id="btnUpdate" value="修改" onclick="FunUpdateQuantity()" />
                    </td>
                </tr>
            </table>
        </div>
    </div>

   

    </form>
          

     <%--商品存储信息编号--%>
    <input type="hidden" id="GoodID" value="" />
    <%--定义编号--%>
    <input type="hidden" id="WBID" value="" />
    <%--定义背景色的隐藏域--%>
    <input type="hidden" id="colorName" value="" />
    
</body>
</html>
